#!/usr/bin/python
# -*- coding:UTF8 -*-
# 函数参数
def f(name, *hobby, course='class', **others):
    print(f'我的名字是:{name}')
    print(f'非常开心参加的课程是:{course}')
    if len(hobby) > 0:
        print(f'我的爱好是：{hobby}')
    elif len(others) > 0:
        print(f'其他信息为：{others}')


f('xiaomi')
f('xiaomi', 'resding')
f('xiaomi', 'resding', 'book', 'sport', course='自动化测试')
f('xiaomi', 'resding', 'book', 'sport', course='自动化测试',money=10000000000)

print('***'.center(50, '='))


def add(x, y):
    return x + y


def mysef(name):
    print(f'我的名字是{name}')


mysef('张三')
mysef('lisir')

num = add(1, 2) + add(3, 3)
print(f'num的返回值为{num}')

# add(5, 6)
print(add(2, 8))


def add(num):
    s = 0
    for i in range(1, num + 1):
        s = s + i
    print(f'1—{num}的和为：{s}')


add(3)
add(100)


# 改进
def add(num1, num2):
    s = 0
    for i in range(num1, num2 + 1):
        s = s + i
    print(f'{num1}—{num2}的和为：{s}')


add(1, 4)


# 获取用户名密码去登录
def get_name_passwd():
    """
    去数据库查询用户名和密码
    :return:
    """
    name = '010101'
    passwd = 123456
    return name
    # return passwd


def login():
    name = get_name_passwd()
    if name == '010101':
        print("登录成功")
    else:
        print("登录失败")


login()


def a():
    print('武松打老虎')


def b():
    print('天王盖地虎')
    a()
    print('我是总经理')


b()


def ao(x, y=10):
    print(f'{x},{y}')


ao(1)
ao(10, 5)
word = ['a', 'c', 'd', 'b', 'f']
word.reverse()
print(word)
nums = '1, -1, 1000, 999, 2000, 100, 300'
print(max(nums))
